<template>
	<form  method="get" >
	    <p>查找的id<input type="text" name="hno"  v-model="searchForm.hno" style="width: 150px;border-color: black"/></p>
	    <input type="button"  value="查找" @click="search"/>
	</form>
	
	
	<form method="get" >
	    <p>删除的id<input type="text" name="hno" v-model="deleteForm.hno" style="width: 150px;border-color: black"/></p>
	    <input type="button"  value="删除" @click="del"/>
	</form>
	
	<form method="get">
	    <p>学生编号<input type="text" name="sno" v-model="addForm.sno"   style="width: 150px;border-color: black"/></p>
	    <p>身高<input type="text" name="height"  v-model="addForm.height"   style="width: 150px;border-color: black"/></p>
	    <p>体重<input type="text" name="weight" v-model="addForm.weight"    style="width: 150px;border-color: black"/></p>
	    <p>胸围<input type="text" name="chest" v-model="addForm.chest"   style="width: 150px;border-color: black"/></p>
	    <input type="button"  value="添加" @click="add"/>
	</form>

	
	<form method="get" >
	    <p>体检编号<input type="text" name="hno" v-model="updateForm.hno" style="width: 150px;border-color: black"/></p>
	    <p>学生编号<input type="text" name="sno" v-model="updateForm.sno" style="width: 150px;border-color: black"/></p>
	    <p>身高<input type="text" name="height" v-model="updateForm.height" style="width: 150px;border-color: black"/></p>
	    <p>体重<input type="text" name="weight" v-model="updateForm.weight" style="width: 150px;border-color: black"/></p>
	    <p>胸围<input type="text" name="chest" v-model="updateForm.chest" style="width: 150px;border-color: black"/></p>
	    <input type="button"  value="更新" @click="update"/>
	</form>
	
</template>

<script>
	export default {
		data() {
			return {
				searchForm: {
					hno: "",
				},
				deleteForm: {
					hno: "",
				},
				addForm: {
					sno: "",
					height: "",
					weight: "",
					chest: "",
				},
				updateForm: {
					hno: "",
					sno: "",
					height: "",
					weight: "",
					chest: "",
				},
			}
		},
		methods: {
			async search() {
				const {
					data: res
				} = await this.$http.get("healthform/selectOne?hno=" + this.searchForm.hno);
				this.$alert(res, '查询结果', {
					confirmButtonText: '确定',
				});
			},
			async del() {
				const {
					data: res
				} = await this.$http.get("healthform/deleteOne?hno=" + this.deleteForm.hno);
				if (res) {
					this.$alert("删除成功", '删除结果', {
						confirmButtonText: '确定',
					});
				} else {
					this.$alert("删除失败", '删除结果', {
						confirmButtonText: '确定',
					});
				}
	
			},
			async add() {
				const {
					data: res
				} = await this.$http.get("healthform/addOne?", {
					params: this.addForm
				});
				this.$alert(res, '添加结果', {
					confirmButtonText: '确定',
				});
			},
			async update() {
				const {
					data: res
				} = await this.$http.get("healthform/updateOne?", {
					params: this.updateForm
				});
				this.$alert(res, '更新结果', {
					confirmButtonText: '确定',
				});
			},
		},
	}
</script>

<style>
</style>
